package org.lex.filter;

public class BooleanFilter extends BooleanRelatedFilter implements Filter<Boolean> {
	private static final String DEFAULT_TRUE = "Only accept true";
	private static final String DEFAULT_FALSE = "Only accept false";

	public BooleanFilter(boolean acceptValue) {
		this(acceptValue, acceptValue ? DEFAULT_TRUE : DEFAULT_FALSE);
	}

	public BooleanFilter(boolean acceptValue, String description) {
		super(acceptValue, description);
	}

	public boolean accept(Boolean o) {
		if (null == o)
			return false;
		return this.value == o.booleanValue();
	}

	public boolean getAcceptValue() {
		return this.value;
	}

	public void setAcceptValue(boolean acceptValue) {
		super.setValue(acceptValue);
	}
}
